#include "pet.h"

Pet::Pet(const QString &type, const QString &name, QObject *parent) : QObject(parent),
    m_hunger(50),
    m_clean(50),
    m_pleasure(50),
    m_level(1),
    m_type(type),
    m_name(name)
{
}

int Pet::getHunger() const
{
    return m_hunger;
}

int Pet::getClean() const
{
    return m_clean;
}

int Pet::getPleasure() const
{
    return m_pleasure;
}

int Pet::getLevel() const
{
    return m_level;
}

QString Pet::getType() const
{
    return m_type;
}

QString Pet::getName() const
{
    return m_name;
}

void Pet::feed()
{
    if (m_hunger < 100)
    {
        m_hunger += 20;
    }
    if (m_hunger > 100)
    {
        m_hunger = 100;
    }
}

void Pet::clean()
{
    if (m_clean < 100)
    {
        m_clean += 20;
    }
    if (m_clean > 100)
    {
        m_clean = 100;
    }
}

void Pet::play()
{
    if (m_pleasure < 100)
    {
        m_pleasure += 20;
    }
    if (m_pleasure > 100)
    {
        m_pleasure = 100;
    }
}

void Pet::status()
{
    m_hunger -= 5;
    m_clean -= 3;
    m_pleasure -= 2;
    if (m_hunger < 0)
    {
        m_hunger = 0;
    }
    if (m_clean < 0)
    {
        m_clean = 0;
    }
    if (m_pleasure < 0)
    {
        m_pleasure = 0;
    }
    if (m_hunger >= 80 && m_clean >= 80 && m_pleasure >= 80)
    {
        m_level++;
    }
}
